"""Added measurement unit to Product

Revision ID: a904af72934b
Revises: 8428b7ddbcfb
Create Date: 2023-11-10 12:01:11.482967

"""
import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "a904af72934b"
down_revision = "8428b7ddbcfb"
branch_labels = None
depends_on = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.execute("CREATE TYPE measurementunit AS ENUM ('grams', 'pcs')")
    op.add_column(
        "product",
        sa.Column(
            "measurement",
            sa.Enum("grams", "pcs", name="measurementunit"),
            server_default="grams",
            nullable=False,
        ),
    )
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column("product", "measurement")
    op.execute("DROP TYPE IF EXISTS measurementunit")
    # ### end Alembic commands ###
